<?
ob_start(); 
include("common/header.html");
$out_html=ob_get_contents();
ob_end_clean();
include('common/errBack.php');
include("class/OrderRecord.php");
$ac=$GLOBALS['_ac'];
$pw=$GLOBALS['_pw'];
$s = new SoapClient(null,
    array("location" => "http://localhost/open/openService/pft_insideMX.php",
    "uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));
$ordernum=$_REQUEST['ordernum'];
$or=new OrderRecord($ordernum,$s);
$info=$or->info();
$ths=array();
$beginTime=$info['mainOrder']->UUbegintime;
if($p_type=="D"){
	$ths[]="订单号";
	$ths[]="商品数";
	$ths[]="总金额(元)";
	$ths[]="预订日期";
	$ths[]="联系人";
	$ths[]="手机号";
}elseif($p_type=="C"){
	$ths[]="订单号";
	$ths[]="房间数";
	$ths[]="总金额(元)";
	$ths[]="入住日期";
	$ths[]="联系人";
	$ths[]="手机号";
	$totalTnum=$totalTnum/count($orders);
}else{
	$ths[]="订单号";
	$ths[]="门票数";
	$ths[]="总金额(元)";
	$ths[]="游玩日期";
	$ths[]="联系人";
	$ths[]="手机号";
}
echo $out_html;
?>
<!--<link type="text/css" rel="stylesheet" href="css/orderSuc.css" media="screen" />-->
    <link type="text/css" rel="stylesheet" href="css/orderPay.css" />
    <link type="text/css" rel="stylesheet" href="css/easydialog.css" />
<div class="wrapCon">
	<div class="detail suc">
        <form style="display: none;" id="ebank" action="ipsOrder.html" method="get" target="_blank">
		    <input type="hidden" id="ordernum" name="ordernum" value="<?=$info['mainOrder']->UUordernum?>"/>
		    <input type="hidden" id="Bankco" name="Bankco" value=""/>
        </form>
        <form style="display: none;" id="alipay" action="alipayOrder.html" method="get" target="_blank">
		    <input type="hidden" id="ordernum" value="<?=$info['mainOrder']->UUordernum?>"/>
        </form>
        <div class="PTwrap wrap">
            <div class="container">
                <?if($info['mainOrder']->UUpmode==1&&$info['mainOrder']->UUpaystatus!=1):?>
                <? $onlinePay = true; ?>
                <!--支付模块BOF-->
                <div class="topDesc">
                    <div class="wareBox">
                        <div class="con">
                            <p class="p1 orange f-18"><i class="icon"></i>订单提交成功，请选择以下支付方式进行支付</p>
                            <p class="p2">注：请于<span class="mrl orange">2小时</span>内完成支付，逾期订单将失效</p>
                            <div class="ebanks">
                                <dl class="ebankpay">
                                    <dt>网上银行：</dt>
                                    <dd>
                                        <input type="radio" gateid="00018" name="ebank_charge" id="eb1">
                                        <label for="eb1" class="ICBC" gateid="00018" title="中国工商银行"></label>
                                    </dd>
                                    <dd>
                                        <input type="radio" gateid="00003" name="ebank_charge" id="eb2">
                                        <label for="eb2" class="CCB" gateid="00003" title="中国建设银行"></label>
                                    </dd>
                                    <dd>
                                        <input type="radio" gateid="00083" name="ebank_charge" id="eb3">
                                        <label for="eb3" class="BOC" gateid="00083" title="中国银行"></label>
                                    </dd>
                                    <dd>
                                        <input id="eb4" type="radio" gateid="00017" name="ebank_charge" id="">
                                        <label for="eb4" class="ABC" gateid="00017" title="中国农业银行"></label>
                                    </dd>
                                </dl>
                                <dl class="more">
                                    <dt>支付平台：</dt>
<!--                                    <dd>-->
<!--                                        <input id="eb10" type="radio" value="alipay" name="ebank_charge">-->
<!--                                        <label for="eb10" class="Alipay" title="支付宝"></label>-->
<!--                                    </dd>-->
                                    <dd>
                                        <input type="radio" gateid="" name="ebank_charge" id="eb11">
                                        <label for="eb11" class="Ips" gateid="" title="环迅支付"></label>
                                    </dd>
                                </dl>
                            </div>
                            <div class="totalPay">应付金额：<span class="orange">¥<?=$info['totalPrice']/100?></span></div>
                        </div>
                    </div>
                </div>
                <button id="submitBtn" type="submit" class="submitBtn_3">确认无误，去支付</button>
                <!-- 弹出层模块BOF -->
                <div id="PayDialog">
                    <p class="tip"><i>&nbsp;</i>付款完成前请勿关闭当前窗口，完成付款后请根据你的情况点击下面按钮。</p>
                    <strong>请在支付页完成付款后再选择：</strong>
                    <div class="pay">
                        <input type="button" class="success" id="PaySuccess" value="已完成付款"/>
                        <input type="button" class="close" value="付款出现问题" />
                    </div>
                    <br/>
                    <a href="javascript:" class="close">&lt;&lt;返回重新选择付款方式</a>
                </div>
                <!-- 弹出层模块EOF -->
                <!-- 支付模块EOF -->
                <?endif?>
                <!--订单信息BOF-->
                <div class="orderBox">
                    <?if(!$onlinePay):?>
                    <div class="title">
                        <i>&nbsp;</i>
                        <span class="suc">您购买的产品已下单成功。</span>
                    </div>
                    <?endif;?>
                    <div class="mainCon" style="clear:both">
                        <h3>产品名称：<a target="_blank" href="scenic_detail.html?lid=<?=$info['mainOrder']->UUlid?>"><?=$info['mainOrder']->UUltitle?></a>
                            <span class="tip">(你可到<a href="buyProduct.html">订单管理</a>进行订单的操作)</span>
                        </h3>
                        <table>
                            <tr>
                                <?foreach($ths as $row){?>
                                    <th><?=$row?></th>
                                <?}?>
                            </tr>
                            <tr>
                                <td><?=$info['mainOrder']->UUordernum?></td>
                                <td><?=$info['totalTnum']?></td>
                                <td><?=$info['totalPrice']/100?></td>
                                <td><?=$info['mainOrder']->UUbegintime?></td>
                                <td><?=$info['mainOrder']->UUordername?></td>
                                <td><?=$info['mainOrder']->UUordertel?></td>
                            </tr>
                        </table>
                        <?if(!$onlinePay):?>
                        <div class="btnWrap">
                            <a href="buyProduct.html"><em class="confirm">确&nbsp;&nbsp;&nbsp;&nbsp;定</em></a>
                        </div>
                        <?endif;?>
                    </div>
                </div>
                <!--订单信息EOF-->
            </div>
        </div>
	</div>
</div>
    <script src="js/easydialog.min.js"></script>
<script>
    jQuery(document).ready(function($) {
        var orderid = $("input[name='orderid']").val(),payResult= 0,interval_id=0;
        var obj_funcs = {
            closeDialog:function() {
                easyDialog.close();
            },
            toPageSucess:function() {
                location.href="buyProduct.html";
            },
            checkPayState:function(){
//                $.get('jh/jh_front.php',{todo:'CheckOrderPay',orderid:orderid},function(res){
//                    if(res==1){
//                        payResult = 1;
//                        clearInterval(interval_id);
//                    }
//                });
            },
            chk:function(){
                setTimeout(this.checkPayState,1000);
            }

        };
        $(".ebanks dd *").click(function(){
            var gateid=$(this).attr("gateid");
            $("#Bankco").val(gateid);
            $(".ebanks dd input").each(function(){
                $(this).attr("checked",false)
            });
            var input=$(this).parent().children().first()
            input.attr("checked",true);
//            $("#submitTo").val(input.attr("name"));
        });
        $("#submitBtn").click(function(){
            var ebank_charge = $("input[name='ebank_charge']:checked").val(),
                submitTo;

            if(!ebank_charge){
                alert("请选择支付方式");
                return false;
            }
            else if(ebank_charge==='alipay') {
                submitTo = 'alipay';
            }
            else {
                submitTo = 'ebank';
            }
            $("form#"+submitTo).submit();
            easyDialog.open({
                container : 'PayDialog',
                fixed : false
            });
//            setTimeout(function(){
//                interval_id = setInterval(obj_funcs.checkPayState, 2000);
//            },20000);
        });
        $(".close").bind('click',function(){
            clearInterval(interval_id);
            obj_funcs.closeDialog();
        });
        $("#PaySuccess").bind('click',function(){
            if(payResult) {
                clearInterval(interval_id);
                obj_funcs.toPageSucess();
            } else {
                alert('您还未支付成功，请在支付成功后点击该按钮');
                return false;
            }
        });
    });
	if($("#alipay").val()==1){
		/*setTimeout(function(){
			window.location="alipayOrder.html?ordernum="+$("#ordernum").val();
		},1000);*/
	}
</script>
<?include("common/footer.html");?>